package com.wei.duowan.bbs.model;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.Nullable;

/**
 * 作者：赵若位
 * 时间：2019/9/6 14:53
 * 联系方式：1070138445
 * 功能：
 */
public class WebViewBean implements Parcelable
{
    /*是否隐藏后退按钮*/
    private boolean isFinish;
    /*是否隐藏ToolBar*/
    private boolean isTitle;
    /*标题*/
    private String title;
    /*WebView链接*/
    private String url;

    public WebViewBean(@Nullable String url)
    {
        this(true, true, null, url);
    }

    public WebViewBean(boolean isFinish, boolean isTitle, String title, String url)
    {
        this.isFinish = isFinish;
        this.isTitle = isTitle;
        this.title = title;
        this.url = url;
    }

    protected WebViewBean(Parcel in)
    {
        isFinish = in.readByte() != 0;
        isTitle = in.readByte() != 0;
        title = in.readString();
        url = in.readString();
    }

    public static final Creator<WebViewBean> CREATOR = new Creator<WebViewBean>()
    {
        @Override
        public WebViewBean createFromParcel(Parcel in)
        {
            return new WebViewBean(in);
        }

        @Override
        public WebViewBean[] newArray(int size)
        {
            return new WebViewBean[size];
        }
    };

    public boolean isFinish()
    {
        return isFinish;
    }

    public void setFinish(boolean finish)
    {
        isFinish = finish;
    }

    public boolean isTitle()
    {
        return isTitle;
    }

    public void setTitle(boolean title)
    {
        isTitle = title;
    }

    public String getTitle()
    {
        return title;
    }

    public void setTitle(String title)
    {
        this.title = title;
    }

    public String getUrl()
    {
        return url;
    }

    public void setUrl(String url)
    {
        this.url = url;
    }

    @Override
    public int describeContents()
    {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i)
    {
        parcel.writeByte((byte) (isFinish ? 1 : 0));
        parcel.writeByte((byte) (isTitle ? 1 : 0));
        parcel.writeString(title);
        parcel.writeString(url);
    }
}
